using System;
using System.Collections.Generic;
using iPhOwa.Exchange.ContentClasses;
using iPhOwa.Exchange.ContentClasses.Fields;
using iPhOwa.Exchange.WebDav.Methods;

namespace iPhOwa.Exchange.Managers
{
	/// <summary>
	/// Encapsulates working with person.
	/// </summary>
    public static class ContactManager
    {
        /// <summary>
        /// Get a list of persons.
        /// </summary>
        public static ICollection<Contact> GetList(Uri path, OwaSession session)
        {
            var properties = new[]
			                 	{
			                 			ContactFields.FirstName
			                 			, ContactFields.LastName
			                 			, ContactFields.Organization
			                 			, ContactFields.Mobile
			                 			, ContactFields.TelephoneNumber
			                 			, ContactFields.Email1
			                 			, ContactFields.Email2
			                 			, ContactFields.Email3
			                 	};

            var search = new Search(path, session, properties);

            var items = new List<Item>(search.Run());

            return items.ConvertAll(i => i as Contact);
        }

        //public static Contact GetSignedInUser(Uri path, OwaSession session)
        //{
        //    Contact retVal;
        //    var properties = new []
        //                        {
        //                            ContactFields.
        //                        };



        //    return retVal;
        //}
    }
}